// Purpose: Make Correction and further cleaning for STUDENT 
// Created on 30 August 2016
// Lastly modified: 18 July 2016



clear all
clear mata
set more off 
cap log close 


global raw_dir "[directory]\Student"
global clean_dir "X[directory]/Cleaned_Data"

cd "$raw_dir"

use "Master_Student - Copy",clear

* Location for 1 survey from GS Karongi, mistake on school location
replace district=9 if KEY=="uuid:9458c944-1226-45ab-a1a0-470cdf4bdb28"
replace sector=111 if KEY=="uuid:9458c944-1226-45ab-a1a0-470cdf4bdb28"
replace cell=164 if KEY=="uuid:9458c944-1226-45ab-a1a0-470cdf4bdb28"
replace village=169 if KEY=="uuid:9458c944-1226-45ab-a1a0-470cdf4bdb28"

*DMAST schools
drop if school==145 
drop if school==60
drop subscriberid	simid	devicephonenum
		


replace group_107=2 if KEY=="uuid:b0fb76ce-554b-489c-bc52-a0a4e5afdb52"


replace school=20 if KEY=="uuid:551e6a91-f2bd-4e97-bb8e-3a8a5e6bf2f0"
replace school=20 if KEY=="uuid:53e52993-f484-49a2-b77c-b5f54f1de1be"
replace school=20 if KEY=="uuid:326569ca-3e46-4de6-a59d-9478ad30c6f6"
replace school=20 if KEY=="uuid:c4831846-fc30-44df-aa87-fc4ad0488314"
replace school=20 if KEY=="uuid:6d7febca-db02-4232-a01a-4c0cf418e519"
replace school=20 if KEY=="uuid:726d7be8-83a8-44a4-8251-789dcdf7da65"
replace school=20 if KEY=="uuid:3933d862-52a2-4db0-a262-19b34b0f4a0a"
replace school=20 if KEY=="uuid:94cd2def-52fe-4f33-b7b1-c2d37c2cd403"
replace school=20 if KEY=="uuid:8bc25f0e-edbc-439d-a8b1-6c2c00300097"
replace school=20 if KEY=="uuid:718665f1-4038-4ff4-b383-4196726e5356"
replace school=20 if KEY=="uuid:1e76b055-53fb-4dd9-94e6-3edbec882856"
replace school=20 if KEY=="uuid:1f105697-7e15-4a5a-845b-edaa13a76f7f"
replace school=20 if KEY=="uuid:f7b646d1-c483-4d8b-8693-e63512ac65c5"
replace school=20 if KEY=="uuid:7dfb47af-3d31-4ad5-9bfe-6672c18a0cc0"
replace school=20 if KEY=="uuid:75343348-a751-4833-a686-19d2e7eb5b3e"

*Change school
replace school=21 if KEY=="uuid:21ac6b6b-9700-430a-be74-d7261d32be1d"
replace school=21 if KEY=="uuid:184bb53a-8892-4236-ad95-779c9780ebd0"
replace school=21 if KEY=="uuid:87fc78df-667f-4b4a-9851-aaf7dac9d108"
replace school=21 if KEY=="uuid:9eb8bfd9-4cdc-490a-814d-40998f291577"
replace school=21 if KEY=="uuid:3e72b725-4f60-4e62-8659-3e8ce9f1a3c6"
replace school=21 if KEY=="uuid:932b17e5-7db5-4567-a068-d806f3bafcd3"
replace school=21 if KEY=="uuid:2f809fab-ecfd-4cfd-98f9-33103d171f5f"
replace school=21 if KEY=="uuid:1adead15-5159-43b7-8184-a27cd58f4c14"
replace school=21 if KEY=="uuid:11f8ad0c-fd7a-4698-97c6-0fb7a21825f8"
replace school=21 if KEY=="uuid:f66195c7-1ec4-4a29-ae64-3de06b5f49f4"
replace school=21 if KEY=="uuid:6d9f5929-c1f2-4dda-b3de-1b1981849f5a"
replace school=21 if KEY=="uuid:bd419417-8fac-401d-954d-b6cb8b48ba43"
replace school=21 if KEY=="uuid:793d7fdc-da5e-4888-a3c2-f8623ce01d29"
replace school=21 if KEY=="uuid:4defa8b9-7eda-47ae-9723-191bfc40157a"
replace school=21 if KEY=="uuid:14c184be-6e73-45c1-9a2d-7e1cbdea8bd6"

*Change school
replace school=22 if KEY=="uuid:96c34bfa-8e50-4873-a832-c5f6d28dab6e"
replace school=22 if KEY=="uuid:55d0d287-16f1-44e1-9787-f8787a7af10c"
replace school=22 if KEY=="uuid:a5ec22e9-f07f-43ed-8dd9-d126c664deeb"
replace school=22 if KEY=="uuid:67689a02-fd9a-4374-9aba-a35fd46d959b"
replace school=22 if KEY=="uuid:b40a3f68-d2a9-48bd-b82e-16ade06ec8b0"
replace school=22 if KEY=="uuid:96dfcf80-42ef-4d3b-bc10-5fdeb44b05ce"
replace school=22 if KEY=="uuid:fc766b67-1184-479e-b563-2af8e19ac18d"
replace school=22 if KEY=="uuid:4e8a1acc-7084-4ffb-b8c2-8413aa4bbc63"
replace school=22 if KEY=="uuid:4d36b7d4-21c2-4b47-b974-0c2b946448a7"
replace school=22 if KEY=="uuid:7856b6a0-57c7-455c-a52c-ae3fede517a4"
replace school=22 if KEY=="uuid:2cf354f3-ce32-41ac-824c-0f327a57face"
replace school=22 if KEY=="uuid:551292c1-eec3-434b-a0a6-119d287175ec"
replace school=22 if KEY=="uuid:a30de3f8-2feb-48f6-85f0-2f878f387b4b"
replace school=22 if KEY=="uuid:93d5ef39-e6dc-4893-b150-68e8084cc45c"
replace school=22 if KEY=="uuid:9d82af4e-b044-4d84-b1f1-dadf73faf1bd"

*Cell
replace cell=210 if KEY=="uuid:41b5529c-5143-4418-9148-734373c4e599"
replace cell=210 if KEY=="uuid:942b8381-bdcb-4f83-8520-55c749753c06"
replace cell=210 if KEY=="uuid:c793a845-9d30-429c-8810-e841d29dc954"
replace cell=210 if KEY=="uuid:43eec33b-e80e-4f49-ad86-9b3b80d73405"
replace cell=210 if KEY=="uuid:282ef3e9-bd22-46a6-918c-ae67dba9a21e"
replace cell=210 if KEY=="uuid:f475a326-8ac6-44c2-a9c5-b8cef58914d5"
replace cell=210 if KEY=="uuid:16405a07-4ea3-441c-860b-a4d371f20c32"
replace cell=210 if KEY=="uuid:8596c6e5-fea8-4154-9219-190074a02d15"
replace cell=210 if KEY=="uuid:6eba94c5-ff55-44ea-bbd6-9b6dcb63d121"
replace cell=210 if KEY=="uuid:8f7bcc72-9f4e-44e1-949c-e5c915ccbb00"
replace cell=210 if KEY=="uuid:2d15480d-32f0-4f08-b9e4-2b4c3f2dd0b8"
replace cell=210 if KEY=="uuid:11dc440a-ea5a-4023-bcb4-03752efb0872"
replace cell=210 if KEY=="uuid:e03142ac-6efb-4148-ae3f-1ef6d2a33671"
replace cell=210 if KEY=="uuid:06d1879e-fa9b-4795-a999-038786441fb7"
replace cell=210 if KEY=="uuid:78fbd74c-46bb-45e8-9237-c2d58ca5ae8d"

*school codes: It was 302117 
replace school_code_106=301117 if school_code_106==302117 

*school codes: It was 40108112 
replace school_code_106=401112 if  school_code_106==40108112

*school codes: It was 405102 
replace school_code_106=504102 if school_code_106==405102

*school codes: It was 0506118 
replace school_code_106=506118 if school_code_106==0506118

*school codes: It was 705034 
replace school_code_106=507034 if school_code_106==705034

(code=0403037)
replace sector_201=-99 if KEY=="uuid:6ae7e308-15db-40df-8f1c-cb9da72efe69"

     *107 School Group 
/*	
The number of students in treated schools is 1,526 (49.3%)
The number of students in controlled schools is 1,569 (50.7%)
*/
*The following schools were in CONTROL bu they are in Group 1 Treatment  
    
replace group_107=1 if school==172
     
replace group_107=1 if school==168

*The following schools were in TREATMENT, but they are in Group 2 Control 
     
    
replace group_107=2 if school==53

	
replace group_107=2 if school==20
     
 
replace group_107=2 if school==109

     
replace group_107=2 if school==98


replace group_107=2 if school==103

   
replace group_107=2 if school==64

   
replace group_107=2 if school==136

    
replace group_107=2 if school==138

   
replace group_107=2 if school==180

    
replace group_107=2 if school==204

    
replace group_107=2 if school==153
       
*Additional corrections
replace group_107=2 if KEY=="uuid:374db504-d473-462d-8958-3b79c895c854"
replace group_107=2 if KEY=="uuid:3e72b725-4f60-4e62-8659-3e8ce9f1a3c6"
replace group_107=2 if KEY=="uuid:090f66e4-514e-49d2-8310-8788599c8ec4"
replace group_107=1 if KEY=="uuid:11cd2c32-862b-43ed-a934-965a0a093d86"
replace group_107=2 if KEY=="uuid:cf595e4f-40ab-4ed9-b625-376ce26d5586"


*2. STUDENT IDENTIFICATION
*201 House location and ownership 
/*Two house the answers were 5 and -77 respectively.
Their location is condidered as "rural"
*/
drop loc_201_2-loc_201_3
rename loc_201_1 loc_201
replace loc_201=1 if loc_201==-77
replace loc_201=1 if loc_201==5

drop house_201_2-house_201_4
rename house_201_1 house_201
replace house_201=. if house_201==-55

replace house_201=2 if KEY=="uuid:8a6913fa-6326-4e3f-8ffb-7e00d670fdf7"
replace house_201=2 if KEY=="uuid:d484773e-69d0-492b-ad13-550c0a51d3b9"
replace house_201=2 if KEY=="uuid:f17dc908-6c24-485d-8ab5-a425c9b7da29"
replace house_201=2 if KEY=="uuid:c7008ef9-995b-4a1e-9bdf-672b47ab6398"
replace house_201=2 if KEY=="uuid:ef08f55e-5cfb-4814-8578-95dafd2b6b7a"
replace house_201=2 if KEY=="uuid:5624b784-d832-4405-978c-1ac349f824e3"
replace house_201=2 if KEY=="uuid:11722049-f774-4dbb-8f2e-fe3b62fbedea"
replace house_201=2 if KEY=="uuid:ad3dcc9a-79a4-4263-a5b5-a66af654e1a7"
replace house_201=2 if KEY=="uuid:ae987ae3-9386-4336-b112-069933c1b1f4"
replace house_201=2 if KEY=="uuid:ebc20761-7d9b-4b9e-9577-9018b091d57c"
replace house_201=2 if KEY=="uuid:b053dcd5-81fa-49d2-ac74-2d691e229d99"

*202 Boarding or day student?
drop board_day_202_2 board_day_202_3
rename board_day_202_1 board_day_202
replace board_day_202=. if board_day_202==-55

replace board_day_202=1 if KEY=="uuid:cb920643-1531-46f9-8aa0-941cf5799a10"
replace board_day_202=2 if KEY=="uuid:2a4434e7-5ba6-4d96-bd13-ccd888da8b52"
replace board_day_202=2 if KEY=="uuid:c0f2fcc7-1c4d-4f51-acb8-f3e7e7c5369e"

*203 Distance from home to school
* For boarding students, dist_km_203 was (.) in stead of "-77" or "0"
replace dist_km_203=. if dist_km_203==-55
replace dist_min_203=. if dist_min_203==-55
replace dist_km_203=. if dist_km_203==-77
replace dist_min_203=. if dist_min_203==-77
replace dist_km_203=. if dist_km_203==0
replace dist_min_203=. if dist_min_203==0
drop unit_dist_203_3
replace dist_km_203=-99 if dist_km_203==99

replace unit_dist_203_2=2 if KEY=="uuid:3663b3a1-3693-4928-840f-8ce3c82b19a5"
replace dist_km_203=3 if KEY=="uuid:3663b3a1-3693-4928-840f-8ce3c82b19a5"

replace unit_dist_203_1=. if unit_dist_203_1==0
replace unit_dist_203_1=. if unit_dist_203_1==3
replace unit_dist_203_1=. if unit_dist_203_1==-55
replace unit_dist_203_1=. if unit_dist_203_1==55

replace unit_dist_203_2=. if unit_dist_203_2==-55
replace unit_dist_203_2=. if unit_dist_203_2==0
replace unit_dist_203_2=. if unit_dist_203_2==30

*204 Means of transport to school

replace trans_204_1=3 if KEY=="uuid:cb920643-1531-46f9-8aa0-941cf5799a10"
replace trans_204_1=3 if KEY=="uuid:cec81636-0cca-4c60-976a-633bd287b816"
replace trans_204_1=4 if KEY=="uuid:f229d762-6bb1-494d-978d-dfd1f772cc2d"
replace trans_204_1=4 if KEY=="uuid:9c77698a-506f-4e54-ada9-cc2d0abf6de0"

drop trans_204_2-trans_204_5
replace trans_204_1=. if trans_204_1==-55
rename trans_204_1 trans_204

*205
replace phonenumbers_1_205phonepers_2051=. if phonenumbers_1_205phonepers_2051==-55
replace phonenumbers_1_205phonepers_2051=. if phonenumbers_1_205phonepers_2051==-55
replace phonenumbers_1_205phonepers_2051=-77 if phonenumbers_1_205phonepers_2051==77

replace phonenumbers_1_205phonepers_2052=. if phonenumbers_1_205phonepers_2052==-55
replace phonenumbers_1_205phonepers_2052=. if phonenumbers_1_205phonepers_2052==-55
replace phonenumbers_1_205phonepers_2052=-77 if phonenumbers_1_205phonepers_2052==77

replace phonenumbers_1_205phonepers_2053=. if phonenumbers_1_205phonepers_2053==-55
replace phonenumbers_1_205phonepers_2053=. if phonenumbers_1_205phonepers_2053==-55
replace phonenumbers_1_205phonepers_2053=-77 if phonenumbers_1_205phonepers_2053==77

drop phonenumbers_1_205phonepers_2054
drop phonenumbers_2_205phonemoth_2054
drop phonenumbers_3_205phonefath_2054
drop phonenumbers_4_205phoneoth_205_4

replace phonenumbers_2_205phonemoth_2051=. if phonenumbers_2_205phonemoth_2051==-55
replace phonenumbers_2_205phonemoth_2051=. if phonenumbers_2_205phonemoth_2051==55
replace phonenumbers_2_205phonemoth_2051=. if phonenumbers_2_205phonemoth_2051==0
replace phonenumbers_2_205phonemoth_2051=-99 if phonenumbers_2_205phonemoth_2051==99
replace phonenumbers_2_205phonemoth_2051=-77 if phonenumbers_2_205phonemoth_2051==77

replace phonenumbers_2_205phonemoth_2052=. if phonenumbers_2_205phonemoth_2052==-55
replace phonenumbers_2_205phonemoth_2052=. if phonenumbers_2_205phonemoth_2052==55
replace phonenumbers_2_205phonemoth_2052=-77 if phonenumbers_2_205phonemoth_2052==77
replace phonenumbers_2_205phonemoth_2052=-99 if phonenumbers_2_205phonemoth_2052==99

replace phonenumbers_2_205phonemoth_2053=. if phonenumbers_2_205phonemoth_2053==-55
replace phonenumbers_2_205phonemoth_2053=. if phonenumbers_2_205phonemoth_2053==55
replace phonenumbers_2_205phonemoth_2053=-77 if phonenumbers_2_205phonemoth_2053==77
replace phonenumbers_2_205phonemoth_2053=-99 if phonenumbers_2_205phonemoth_2053==99

replace phonenumbers_2_205phone_moth_1_2="" if phonenumbers_2_205phone_moth_1_2=="-55"
replace phonenumbers_2_205phone_moth_1_2="" if phonenumbers_2_205phone_moth_1_2=="55"	
replace phonenumbers_2_205phone_moth_2_2="" if phonenumbers_2_205phone_moth_2_2=="-55"
replace phonenumbers_2_205phone_moth_2_2="" if phonenumbers_2_205phone_moth_2_2=="55"

	
replace phonenumbers_2_205phone_moth_3_2="" if phonenumbers_2_205phone_moth_3_2=="-55"|phonenumbers_2_205phone_moth_3_2=="55"
replace phonenumbers_3_205fath_name_205="" if phonenumbers_3_205fath_name_205=="-55"|phonenumbers_3_205fath_name_205=="55"

replace phonenumbers_3_205phonefath_2051=. if phonenumbers_3_205phonefath_2051==-55|phonenumbers_3_205phonefath_2051==55
replace phonenumbers_3_205phonefath_2052=. if phonenumbers_3_205phonefath_2052==-55|phonenumbers_3_205phonefath_2052==55
replace phonenumbers_3_205phonefath_2053=. if phonenumbers_3_205phonefath_2053==-55|phonenumbers_3_205phonefath_2053==55

replace phonenumbers_3_205phone_fath_1_2="" if phonenumbers_3_205phone_fath_1_2=="-55"
replace phonenumbers_3_205phone_fath_2_2="" if phonenumbers_3_205phone_fath_2_2=="-55"	
replace phonenumbers_3_205phone_fath_3_2="" if phonenumbers_3_205phone_fath_3_2=="-55"
replace phonenumbers_4_205oth_name_205="" if phonenumbers_4_205oth_name_205=="-55"

replace phonenumbers_4_205phoneoth_205_1=. if phonenumbers_4_205phoneoth_205_1==-55	
replace phonenumbers_4_205phoneoth_205_2=. if phonenumbers_4_205phoneoth_205_2==-55
replace phonenumbers_4_205phoneoth_205_3=. if phonenumbers_4_205phoneoth_205_3==-55

replace phonenumbers_4_205phone_oth_1_20="" if phonenumbers_4_205phone_oth_1_20=="-55"
replace phonenumbers_4_205phone_oth_2_20="" if phonenumbers_4_205phone_oth_2_20=="-55"	
replace phonenumbers_4_205phone_oth_3_20="" if phonenumbers_4_205phone_oth_3_20=="-55"	
replace emails_206email_pers="" if emails_206email_pers=="-55"
replace emails_206email_oth="" if emails_206email_pers=="-55"

*3. SOCIO ECONOMIC BACKGROUND CHARACTERISTICS


replace age_300=. if age_300==-55|age_300==55
replace age_300=18 if KEY=="uuid:93ba80e1-4cc6-4699-97b0-ed61a19237b6"
replace age_300=18 if KEY=="uuid:6b869e8f-1434-4fed-ad24-75feb2e01381"

replace age_300=20 if KEY=="uuid:00cac7ab-75ad-40dd-855f-22ffe6b49f5b"

replace age_300=17 if KEY=="uuid:1006ab32-f1c9-42e3-90c3-2d6bf4d23fc8"

replace age_300=22 if KEY=="uuid:b3f2998b-bfda-4019-98e3-b4779bb7c36f"

replace age_300=20 if KEY=="uuid:20d574d0-107c-467e-a5b7-cba3332a3973"

*302 Do you have parents?
drop parents_302_2-parents_302_5
rename parents_302_1 parents_302
replace parents_302=. if parents_302==-55

replace parents_302=3 if KEY=="uuid:e38a101f-dbb0-42f6-b818-6b991fe08a3f"
replace parents_302=3 if KEY=="uuid:94349b82-00c6-4467-8123-4c4640494b11"
replace parents_302=3 if KEY=="uuid:a025b457-d5f2-43c6-a967-6a937b405dbc"
replace parents_302=3 if KEY=="uuid:e96bf3fd-6785-453a-8737-d2853e178dfb"
replace parents_302=3 if KEY=="uuid:c754eeb6-c9e7-4315-aa2a-43f8c863d3c5"
replace parents_302=3 if KEY=="uuid:2a2fadb1-8813-44f0-93aa-66bf67057bb6"

*303 Main floor materials
drop floor_mat_303_3-floor_mat_303_7
replace floor_mat_303_1=. if floor_mat_303_1==-55
replace floor_mat_303_2=. if floor_mat_303_2==-55
replace floor_mat_303_1=-66 if floor_mat_303_1==6
replace floor_mat_303_1=4 if KEY=="uuid:1e897bd5-6a12-4452-924b-e843b11cb772"

lab def floor_mat_303 -66 "Other (Specify)", modify
lab val floor_mat_303_1 floor_mat_303
drop floor_mat_303_2
rename floor_mat_303_1 floor_mat_303


*304 Main roff materials
/*In rural areas, it is possible to find houses of which one part is made of "Plastic sheetings" and
the other part is made of "Cement/concrete/clay/tiles"
*/
drop roof_mat_304_3-roof_mat_304_7
replace roof_mat_304_1=. if roof_mat_304_1==-55
replace roof_mat_304_2=. if roof_mat_304_2==-55|roof_mat_304_2==55
replace roof_mat_304_2=. if roof_mat_304_2==3
replace roof_mat_304_2=. if roof_mat_304_2==6
replace roof_mat_304_other="" if roof_mat_304_other=="-55"
replace roof_mat_304_other="" if roof_mat_304_other=="55"

replace roof_mat_304_1=5 if KEY=="uuid:5e9e3a11-c6b1-419a-9115-d6d6778bc48d"
replace roof_mat_304_1=3 if KEY=="uuid:1076c066-04c5-45ef-bc6c-e38b729265e4"
replace roof_mat_304_1=3 if KEY=="uuid:2e135ef9-333f-4f8e-9b20-fdab2fe3b73a"
replace roof_mat_304_1=3 if KEY=="uuid:fd0189e4-03dc-4996-8773-ada85f887486"
replace roof_mat_304_1=3 if KEY=="uuid:520a2607-d0d7-45b1-b11c-95d8ad06932e"
replace roof_mat_304_1=3 if KEY=="uuid:81e6fd26-7fcf-461e-b91f-61b134ee6a0b"
replace roof_mat_304_1=3 if KEY=="uuid:20427fec-72be-40ea-a56a-35655a47b817"
replace roof_mat_304_1=3 if KEY=="uuid:ca77b052-d58d-47ed-a4c2-6a7df0a06120"
replace roof_mat_304_1=4 if KEY=="uuid:504f95b2-18a9-4624-ab92-d349c7b2fe8c"
replace roof_mat_304_1=3 if KEY=="uuid:39ee6a4b-59b6-41d2-b69b-d6961379d189"
replace roof_mat_304_1=3 if KEY=="uuid:b523ca24-0039-4a91-a9b5-32162b8e8c73"
replace roof_mat_304_1=5 if KEY=="uuid:08f61195-ffb1-42d3-ad05-c7f499f960d7"
replace roof_mat_304_1=3 if KEY=="uuid:1076c066-04c5-45ef-bc6c-e38b729265e4"
replace roof_mat_304_1=3 if KEY=="uuid:40cc246f-ece4-4517-a4a8-ac1bc4cb50bc"
replace roof_mat_304_2=. if KEY=="uuid:40cc246f-ece4-4517-a4a8-ac1bc4cb50bc"
replace roof_mat_304_other="" if KEY=="uuid:40cc246f-ece4-4517-a4a8-ac1bc4cb50bc"


rename roof_mat_304_1 roof_mat_304
replace roof_mat_304=-66 if roof_mat_304==6
lab def roof_mat_304 -66 "Other", modify
lab val roof_mat_304 roof_mat_304

drop roof_mat_304_2 


*305 HH's water sources 
drop water_305_4-water_305_9
replace water_305_1=. if water_305_1==-55
replace water_305_2=. if water_305_2==-55
replace water_305_3=. if water_305_3==-55
replace water_305_1=-66 if water_305_1==8
drop water_305_3
order water_305_2 water_305_other, after(water_305_1)
drop water_305_2 
rename water_305_1 water_305

lab define water_305 -66 "Other(Specify)", modify
lab val water_305 water_305

order water_305_other, after( water_305)

*306Have following assets 
	
local item "Radio Television Telephone Refrigerator Bicycle Motorcycle PrivateCar Other"
foreach t in `item'{
	gen assets_306_`t'=0
	lab variable assets_306_`t' "306_Do you have any of the following assets in your house?"
	lab value assets_306_`t' yesno
	}
	foreach var in assets_306_1 assets_306_2 assets_306_3 assets_306_4 assets_306_5 assets_306_6 assets_306_7 assets_306_8 assets_306_9{
	replace assets_306_Radio=1 if `var'==1
	replace assets_306_Television=1 if `var'==2
	replace assets_306_Telephone=1 if `var'==3
	replace assets_306_Refrigerator=1 if `var'==4
	replace assets_306_Bicycle=1 if `var'==5
	replace assets_306_Motorcycle=1 if `var'==6
	replace assets_306_PrivateCar=1 if `var'==7 
	replace assets_306_Other=1 if `var'==8
	}
drop assets_306_1 assets_306_2 assets_306_3 assets_306_4 assets_306_5 assets_306_6 assets_306_7 assets_306_8 assets_306_9
order assets_306_*, after(water_305)

	*307Main source of energy

gen cook_307=cook_307_1
foreach var in cook_307_2-cook_307_8{
	replace cook_307=`var' if !inlist(cook_307_1,1,2,3,4,5,6,-66)
	}
lab value cook_307 cook_307
replace cook_307=cook_307_1 if mi(cook_307)
replace cook_307=1 if cook_307==-55
replace cook_307=-66 if cook_307==7
lab def mycook 1 "Wood" 2 "Charcoal" 3 "Gas" 4 "Electricity" 5 "Kerosene" 6 "Waste/debris/burning material" -66 "Other(specify)"
lab val cook_307 mycook
replace cook_307=-66 if cook_307_other=="herbage"
lab var cook_307 "307_What is the main energy source for cooking in your household?"
drop cook_307_1-cook_307_8
order cook_307, after (assets_306_Other)
order cook_307_other, after(cook_307)

	*308
gen light_308=light_308_1
foreach var in light_308_2-light_308_11{
	replace light_308=`var' if !inlist(light_308_1,1,2,3,4,5,6,7,8,9,-66)
	}
gsort light_308
lab def lightop 1 "Electricty" 2 "Generator" 3 "Lantern" 4 "Gas Lantern" 5 "Fireplace" 6 "Candle" 7 "Traditional lamp" 8 "Solar power" 9 "Batteries (including torches)" -66 "Other(specify)" 
lab val light_308 lightop
replace light_308=-66 if light_308_1==10
drop light_308_1-light_308_11

replace light_308=8 if light_308_other=="8"
replace light_308_other="" if light_308_other=="8"
replace light_308=3 if light_308==.
order light_308 , after(cook_307)
order light_308_other, after(light_308)

replace light_308_other="" if light_308!=-66

	*309Mother & Father 
g moth_occup_309=moth_occup_309_1
foreach var in moth_occup_309_1-moth_occup_309_9{
	replace moth_occup_309=`var' if !inlist(moth_occup_309_1,1,2,3,4,5,6,7,-66)
	}
decode moth_occup_309_1,gen(moth_occup_temp)
replace moth_occup_309_other=moth_occup_temp if moth_occup_309==.
gsort -moth_occup_309
replace moth_occup_309=-66 if moth_occup_temp=="other" 
lab def jobs 1 "Farming" 2 "Business" 3 "Petty trading" 4 "Casual labor" 5 "Skilled labor (carpenter, tailor,etc)" 6 "Professional/salaried (lawyer,doctor,accountant,teacher,etc.)"  7 "NA" -66 "Other(specify)"
lab val moth_occup_309 jobs
lab var moth_occup_309 "309_What is your father/mother/guardian's main occupation?"
drop moth_occup_309_1-moth_occup_309_9
drop moth_occup_temp

g fath_occup_309=fath_occup_309_1
foreach var in fath_occup_309_1-fath_occup_309_1{
	replace fath_occup_309=`var' if !inlist(fath_occup_309_1,1,2,3,4,5,6,7,-66)
	}
decode fath_occup_309_1,gen(fath_occup_temp)
replace fath_occup_309_other=fath_occup_temp if fath_occup_309==.
gsort -fath_occup_309
replace fath_occup_309=-66 if fath_occup_temp=="other" 
replace fath_occup_309=. if fath_occup_temp=="No answer"|fath_occup_temp==""|fath_occup_temp=="55"
*lab def jobs 1 "Farming" 2 "Business" 3 "Petty trading" 4 "Casual labor" 5 "Skilled labor (carpenter, tailor,etc)" 6 "Professional/salaried (lawyer,doctor,accountant,teacher,etc.)"  7 "NA" -66 "Other(specify)"
lab val fath_occup_309 jobs
lab var fath_occup_309 "309_What is your father/mother/guardian's main occupation?"
drop fath_occup_309_1-fath_occup_309_9
drop fath_occup_temp

gsort -fath_occup_309_other
replace fath_occup_309=. if fath_occup_309_other=="-55" & !inlist(fath_occup_309,1,2,3,4,5,6,-66)
replace fath_occup_309=3 if fath_occup_309_other=="STONE MINING TRADING"
replace fath_occup_309_other="" if fath_occup_309_other=="STONE MINING TRADING"

replace fath_occup_309=1 if fath_occup_309_other=="PETTY CULTIVATOR"
replace fath_occup_309_other="" if fath_occup_309_other=="PETTY CULTIVATOR"

replace fath_occup_309=5 if fath_occup_309_other=="Doctor"
replace fath_occup_309_other="" if fath_occup_309_other=="Doctor"
replace fath_occup_309_other="" if !inlist(fath_occup_309,1,2,3,4,5,6,-66)
replace fath_occup_309_other="" if fath_occup_309!=-66
replace fath_occup_309=. if fath_occup_309_other=="-99"|fath_occup_309_other=="-55"
replace fath_occup_309_other="" if fath_occup_309_other=="-99"|fath_occup_309_other=="-55"

replace moth_occup_309=. if moth_occup_309_other=="-55"
replace moth_occup_309_other="" if moth_occup_309==.
replace moth_occup_309=-66 if moth_occup_309_other=="PASTOR"
replace moth_occup_309_other="" if moth_occup_309!=-66

order fath_occup_309 fath_occup_309_other moth_occup_309 moth_occup_309_other,after(light_308_other)

rename fath_occup_309 occup_mother_309
rename fath_occup_309_other occup_mother_309_other
rename moth_occup_309 occup_father_309
rename moth_occup_309_other occup_father_309_other
	
order occup_father_309 occup_father_309_other, after(light_308_other)


	*310Education 
gen educ_fath_310=educ_fath_310_1 
replace educ_fath_310=-99 if educ_fath_310==99
replace educ_fath_310=-77 if educ_fath_310==77
replace educ_fath_310=-55 if educ_fath_310==55
replace educ_fath_310=-66 if educ_fath_310==5
lab def edu 0 "No education" 1 "Primary" 2 "Secondary" 3 "Technical" 4 "University" -66 "Other(specify)" -99 "Do not know" -77 "Don't have" 
lab val educ_fath_310 edu
replace educ_fath_310=. if educ_fath_310==-55
lab var educ_fath_310 " 310_What is the highest level of education reached by your father/ male guardian?"
replace educ_fath_310=4 if educ_fath_310_other=="P.H.D"|educ_fath_310_other=="P H D"
replace educ_fath_310_other=" " if educ_fath_310_other=="P.H.D"|educ_fath_310_other=="P H D"
replace educ_fath_310_other="" if educ_fath_310!=-66
replace educ_fath_310_other="" if educ_fath_310_other=="66"
drop educ_fath_310_1-educ_fath_310_9

gen educ_moth_310=educ_moth_310_1 
replace educ_moth_310=-99 if educ_moth_310==99
replace educ_moth_310=-77 if educ_moth_310==77
replace educ_moth_310=-55 if educ_moth_310==55
replace educ_moth_310=-66 if educ_moth_310==5
lab val educ_moth_310 edu
replace educ_moth_310=. if educ_moth_310==-55
lab var educ_moth_310 "310_What is the highest level of education reached by your mother/ female guardian?"
replace educ_moth_310=3 if educ_moth_310_other=="Masters"
replace educ_moth_310_other="" if educ_moth_310_other=="Masters" 
replace educ_moth_310_other="" if educ_moth_310_other=="4" 
replace educ_moth_310_other="" if educ_moth_310_other=="." 
drop educ_moth_310_1-educ_moth_310_9


gen educ_sibling_310=educ_sibling_310_1 
replace educ_sibling_310=-99 if educ_sibling_310==99
replace educ_sibling_310=-77 if educ_sibling_310==77
replace educ_sibling_310=-55 if educ_sibling_310==55
replace educ_sibling_310=-66 if educ_sibling_310==5
lab val educ_sibling_310 edu

replace educ_sibling_310=. if educ_sibling_310==-55
lab var educ_sibling_310 "310_What is the highest level of education reached by your sibling/any person at home?"

drop educ_sibling_310_1-educ_sibling_310_9
order educ_fath_310 educ_fath_310_other educ_moth_310 educ_moth_310_other educ_sibling_310 educ_sibling_310_other , after(occup_mother_309_other)

replace educ_sibling_310_other="" if educ_sibling_310_other=="-55"
replace educ_sibling_310_other="" if educ_sibling_310_other=="6"
replace educ_sibling_310_other="Technical" if educ_sibling_310_other=="3"

drop educ_moth_310_other
replace educ_sibling_310=-66 if educ_sibling_310==6
replace educ_sibling_310=4 if educ_sibling_310_other=="masters"|educ_sibling_310_other=="Masters"
replace educ_sibling_310=3 if educ_sibling_310_other=="Technical"
replace educ_sibling_310_other="" if educ_sibling_310!=-66

*311 Home members' businesses
drop business_311_2 business_311_3
rename business_311_1 business_311
replace business_311=. if business_311==-55
replace business_311=0 if business_311==6

replace business_311=0 if KEY=="uuid:7f6314d6-6948-408c-84e2-6856a729ea01"
replace business_311=0 if KEY=="uuid:4baf6fce-5d3f-4560-8797-66d2df0dd575"
replace business_311=0 if KEY=="uuid:8a6913fa-6326-4e3f-8ffb-7e00d670fdf7"
replace business_311=0 if KEY=="uuid:d971d504-ef94-4e1f-94f1-cd3374c1788d"
replace business_311=0 if KEY=="uuid:83173870-a03b-4fe3-a7ad-ce45af689a2a"
replace business_311=0 if KEY=="uuid:09bd4004-f049-4f6f-b90f-b6bdb9bd2ad9"
replace business_311=0 if KEY=="uuid:821dd8a2-4118-4718-886e-26391a5a0e4c"
replace business_311=0 if KEY=="uuid:f02b0468-2eaa-4e73-80e5-87f1a801b706"
replace business_311=0 if KEY=="uuid:52441e94-181e-4221-9d7d-e46285d0670f"
replace business_311=0 if KEY=="uuid:964f7e7b-4bce-484e-8356-af0818a13667"
replace business_311=0 if KEY=="uuid:bfe97295-6434-41a7-855b-a4bd250ec816"

*312
replace bus_info_212know_a_i_312=. if bus_info_212know_a_i_312==-55
replace bus_info_212owner_312="" if bus_info_212owner_312=="-77"
replace bus_info_212owner_312="" if bus_info_212owner_312=="1"
replace bus_info_212owner_312="-99" if bus_info_212owner_312=="99"
replace bus_info_212relationship_312=. if bus_info_212relationship_312==-55
replace bus_info_212know_b_312=. if bus_info_212know_b_312==-55
replace bus_info_212bus_details_b__312=. if bus_info_212bus_details_b__312==-55
replace bus_info_212know_c_312=. if bus_info_212know_c_312==-55
replace bus_info_212bus_details_c__312="" if bus_info_212bus_details_c__312=="-55"
replace bus_info_212bus_details_c__312="" if bus_info_212bus_details_c__312=="1"

*4. ACADEMIC BACKGROUND AND PERFORMANCE 

*400
replace opt_400="LFK" if class_400=="LFK"
*replace class_400="-77" if class_400=="LFK" 
replace class_400="" if class_400=="-77"

replace opt_400="LKK" if opt_400=="LEKK" 
replace opt_400="LFK" if opt_400=="LEFK" 
replace opt_400="LKF" if opt_400=="EFKL"
replace opt_400="LKK" if opt_400=="EKK/ELKK"
replace opt_400="LKK" if opt_400=="EKK/ERKK"
replace opt_400="LKK" if opt_400=="EKK(LKK)"
replace opt_400="" if opt_400=="-77" 

replace stream_appl_400=-77 if KEY=="uuid:90b184d6-e5f2-4eb8-aa61-ed2a7d62bb70"
replace stream_400="" if KEY=="uuid:90b184d6-e5f2-4eb8-aa61-ed2a7d62bb70"
replace stream_400="A" if stream_400=="AB"
replace stream_400="" if stream_400=="blanc"
 
gen opt_400up=upper(opt_400)
replace opt_400=opt_400up
drop opt_400up
gen class_400up=upper(class_400)
replace class_400=class_400up
drop class_400up
replace class_400="S4" if class_400=="s4"|class_400=="S4A"

replace class_400="" if class_400=="MEG" & opt_400=="MEG"

replace class_appl_400=-77 if class_400=="-55"
replace class_400="" if class_400=="-55"

replace opt_400="MEG" if class_400=="MEG"

replace opt_400="HEG" if stream_400=="HEG" & class_400=="S4"
replace stream_400="" if stream_400=="HEG" & opt_400=="HEG"
replace stream_400="" if stream_400=="G.S.K" 

replace opt_400="" if opt_400=="."

replace stream_appl_400=-77 if stream_400=="Rugali"
replace stream_400="" if stream_400=="Rugali"

replace stream_appl_400=-77 if inlist(stream_appl_400,77,55)
replace stream_400="" if inlist(stream_400,"77","55")
replace stream_appl_400=-77 if stream_400=="-77"
replace stream_400="" if stream_400=="-77"|stream_400=="S4"
replace stream_400="A" if stream_400=="S4A"
*replace stream_400="" if stream_400=
replace stream_appl_400=. if stream_appl_400==-55


*401
replace entr_teach_401="" if entr_teach_401=="-55"

*402 Repeating levels
drop repeating_402_2-repeating_402_4
rename repeating_402_1 repeating_402
replace repeating_402=. if repeating_402==-55

replace repeating_402=1 if repeating_402==.

*403 Number of Repeating levels 
replace reptimes_403=. if reptimes_403==-55
/* It is assumed that those who indicated -77 meant that they did not repeat a class.
Thus a value of zero is given
*/
replace reptimes_403=0 if reptimes_403==-77
replace reptimes_403=1 if KEY=="uuid:3f5387da-6b9a-4f3e-9c8a-4c07ac60b371"
replace reptimes_403=0 if  reptimes_403==.


*404 Aggregate Marks
replace aggr_404=. if aggr_404==-55
/* It is assumed that those who indicated -77 meant that they did not know their marks.
Thus a value of -99 is given
*/
replace aggr_404=-99 if aggr_404==-77

*405 Marks in Maths
replace math_405=. if math_405==-55
replace math_405=-99 if math_405==-77|math_405==.

*5 LABOUR MARKET AND ENTREPRENEURIAL OUTCOMES
     *500 Earn money?
	 
rename earn_500_1 earn_500
replace earn_500=0 if KEY=="uuid:afc61595-a1cd-45d0-bc03-e15610f65ffe"
replace earn_500=0 if KEY=="uuid:2ee15980-d03d-4087-84f0-1b85e5ae3cf7"
replace earn_500=0 if KEY=="uuid:d9f0a9c4-f6c6-4dd9-9049-7a21b10bcf84"
replace earn_500=0 if KEY=="uuid:8c7d519b-f535-46ba-bde4-57495efee0d6"
replace earn_500=0 if KEY=="uuid:ff031d97-da6d-480f-9e8f-996206f1afe5"
replace earn_500=0 if KEY=="uuid:493c4440-d546-48a3-9f04-141dbab4098c"
replace earn_500=0 if KEY=="uuid:95f7e6a2-896e-442a-8946-ef39cb87c29e"
replace earn_500=0 if KEY=="uuid:73f19910-6aac-433c-a99a-b87088a738c4"
replace earn_500=0 if KEY=="uuid:547f653d-921f-4609-bfe9-936bc49f325d"

drop earn_500_2 earn_500_3
replace earn_500=. if earn_500==-55|earn_500==55
replace earn_500=0 if earn_500==.

     *501
drop  source_501_2- source_501_5
rename  source_501_1  source_501
replace  source_501=. if  source_501==-55|source_501==55
replace source_501=-66 if source_501==4

     *502
drop oft_502_2-oft_502_5
rename oft_502_1 oft_502
replace oft_502=. if oft_502==-55|oft_502==55
replace oft_502=. if oft_502==5

     *503
replace amt_503=. if amt_503==-55
replace amt_503=-99 if amt_503==-77
 
 *6.BUSINESS CREATION
	
 	*600 / no observations
drop ownbusns_600_2 ownbusns_600_3
rename ownbusns_600_1 ownbusns_600
replace ownbusns_600=. if ownbusns_600==-55

replace ownbusns_600=0 if KEY=="uuid:0a101192-1f76-4902-94ca-856ec6b6dcd4"
replace ownbusns_600=0 if KEY=="uuid:cd7decfc-5a8a-4f46-a4d5-0bf36c723230"
replace ownbusns_600=0 if KEY=="uuid:784e7c75-1ca5-4d8f-822e-1fd253204fcf"
replace ownbusns_600=0 if KEY=="uuid:4b06865d-9e68-49d3-aa51-f3960877863b"
replace ownbusns_600=0 if KEY=="uuid:2ec3a287-240d-421b-8370-213f8f101fbf"
replace ownbusns_600=0 if KEY=="uuid:72d17501-5741-46fa-abcc-546692e1fb52"
replace ownbusns_600=0 if KEY=="uuid:5b545297-bf44-4a78-ae03-4c485626a13c"
replace ownbusns_600=0 if KEY=="uuid:edd6733e-eb16-45c1-9ba1-b85fc3f96541"
replace ownbusns_600=0 if KEY=="uuid:953edb6e-0a2a-4463-a835-4d51a9109f62"
	
	*601
drop ifyes_ownbusns_600profbus_601_3-ifyes_ownbusns_600profbus_601_12
rename ifyes_ownbusns_600profbus_601_1 ifyes_ownbusns_600profbus_601
replace ifyes_ownbusns_600profbus_601=. if ifyes_ownbusns_600profbus_601==-55
replace ifyes_ownbusns_600profbus_601=-66 if ifyes_ownbusns_600profbus_601==11

lab def profbus_601 -66 "Other(specify)", modify
lab val ifyes_ownbusns_600profbus_601 profbus_601

	*602
drop ifyes_ownbusns_600bus_unit_602_1 ifyes_ownbusns_600bus_unit_602_2 ifyes_ownbusns_600bus_unit_602_3
drop ifyes_ownbusns_600profbus_601_2

replace ifyes_ownbusns_600months_602=. if ifyes_ownbusns_600months_602==-55
replace ifyes_ownbusns_600months_602=. if ifyes_ownbusns_600months_602==-99
replace ifyes_ownbusns_600months_602=. if KEY=="uuid:70d4e28a-befc-4069-b6d8-1ca344af6653"
replace ifyes_ownbusns_600months_602=. if ifyes_ownbusns_600months_602==62
replace ifyes_ownbusns_600months_602=. if KEY=="uuid:3472d510-92c8-4758-9517-f054cbc0be97"
replace ifyes_ownbusns_600months_602=. if KEY=="uuid:cb39b2a0-5e29-426a-a872-37cf1dbaeac0"
replace ifyes_ownbusns_600months_602=. if KEY=="uuid:bddbaf91-9945-4e8f-8778-88ccd03117c2"

replace ifyes_ownbusns_600days_602=. if ifyes_ownbusns_600days_602==-55
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:cc443f33-6f6d-4e5a-b70e-8a93716e9853"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:68df6bbc-9c33-4699-8f7f-2961000166b7"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:69f5d6c2-418d-4fda-9bd3-ae4e28d9f29a"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:e96bf3fd-6785-453a-8737-d2853e178dfb"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:3472d510-92c8-4758-9517-f054cbc0be97"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:0fe5b43e-0704-4464-94e6-5f5f912165ae"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:6e4c01d6-3d56-4842-9174-6ba35ddc5c07"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:0b260a73-517b-4e62-bae0-e3113f229f2b"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:7d05ff43-6b16-4330-b318-91a826501b25"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:ce0109a7-395f-4f46-b5c3-a1d0c619ffaa"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:1c243554-a9b9-4aba-a3fa-ca63a7e56076"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:e093c9f0-cc5c-4bc2-9359-84d49bb6f76f"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:0a1491c5-cfd3-4ee0-ba7b-6bf317a0ebe7"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:b0d61ec8-fcb4-490e-be51-b82d5c02455f"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:d35c5b89-ceb4-434e-8328-12648b3ae1b2"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:15df3f56-3d29-4a01-bbbb-f811c5bf3bc0"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:d99834e7-683d-4494-97dd-a9f9d5c5d726"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:4bc6bf5a-ba87-49fc-80d8-def09ce6084e"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:7dfb47af-3d31-4ad5-9bfe-6672c18a0cc0"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:6a8d3b2a-6911-492f-ab16-3583307a16ca"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:54430783-8b0b-491e-8336-aa89f594c637"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:4b729a2c-a3dc-46e2-9939-ad542ce47cfb"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:06cba5fb-54b3-42a2-bddc-d972288b734d"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:0476e9b9-81a2-429a-96fa-6e008a1b2006"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:bf1ab707-dbcf-4276-88ab-ea3cfa707be7"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:7a6ea1c3-3ade-4f8a-a1cd-764e35c2e49e"
replace ifyes_ownbusns_600days_602=. if KEY=="uuid:92974a28-7506-4a97-bbff-cf276a60f6f6"

    *603 ifyes_ownbusns_600grpproj_spec_6
replace ifyes_ownbusns_600grpproj_spec_6="" if ifyes_ownbusns_600grpproj_spec_6=="-55"
replace ifyes_ownbusns_600grpproj_spec_6="" if ifyes_ownbusns_600grpproj_spec_6=="55"
replace ifyes_ownbusns_600grpproj_spec_6="" if ifyes_ownbusns_600grpproj_spec_6=="-77"
replace ifyes_ownbusns_600grpproj_spec_6="" if ifyes_ownbusns_600grpproj_spec_6=="12"

	*604
drop ifyes_ownbusns_600with_604_6-ifyes_ownbusns_600with_604_11
replace ifyes_ownbusns_600with_604_1=. if ifyes_ownbusns_600with_604_1==-55
replace ifyes_ownbusns_600with_604_1=. if ifyes_ownbusns_600with_604_1==55

	*605
replace ifyes_ownbusns_600amt_605=. if ifyes_ownbusns_600amt_605==-55
replace ifyes_ownbusns_600amt_605=. if ifyes_ownbusns_600amt_605==-77
replace ifyes_ownbusns_600amt_605=. if ifyes_ownbusns_600amt_605==-99
replace ifyes_ownbusns_600amt_605=. if ifyes_ownbusns_600amt_605==0

	*606
drop ifyes_ownbusns_600getmoney_6064-ifyes_ownbusns_600getmoney_60611
replace ifyes_ownbusns_600getmoney_6061=. if ifyes_ownbusns_600getmoney_6061==-55|ifyes_ownbusns_600getmoney_6061==0

replace ifyes_ownbusns_600getmoney_6061=10 if KEY=="uuid:f14760b6-54d1-43c2-8203-74749bbc847a"


	*607
drop ifyes_ownbusns_600earn_607_2 ifyes_ownbusns_600earn_607_3
rename ifyes_ownbusns_600earn_607_1 ifyes_ownbusns_600earn_607
replace ifyes_ownbusns_600earn_607=. if ifyes_ownbusns_600earn_607==-55

replace ifyes_ownbusns_600earn_607=1 if KEY=="uuid:42aaed76-b522-45e7-b748-9d60cee279b4"
replace ifyes_ownbusns_600earn_607=0 if KEY=="uuid:c0f2fcc7-1c4d-4f51-acb8-f3e7e7c5369e"
replace ifyes_ownbusns_600earn_607=0 if KEY=="uuid:63721971-b75f-4ef2-ab8f-d1e5abc8935c"
replace ifyes_ownbusns_600earn_607=0 if KEY=="uuid:88477cfe-4d6f-41ca-b000-4524df533c37"
replace ifyes_ownbusns_600earn_607=1 if ifyes_ownbusns_600earn_607==0 & ifyes_ownbusns_600amtbus_608==8000
replace ifyes_ownbusns_600earn_607=0 if KEY=="uuid:5050f0c0-a3a5-4ca2-9a39-7c0b8a2094eb"
replace ifyes_ownbusns_600earn_607=0 if KEY=="uuid:a270f279-a387-48bd-ac1f-7a6a9c2cc6e5"
replace ifyes_ownbusns_600earn_607=0 if ifyes_ownbusns_600amtbus_608==0

   *608
replace ifyes_ownbusns_600amtbus_608=. if ifyes_ownbusns_600amtbus_608==-55
replace ifyes_ownbusns_600amtbus_608=. if ifyes_ownbusns_600amtbus_608==-77
replace ifyes_ownbusns_600amtbus_608=. if ifyes_ownbusns_600amtbus_608==-99
replace ifyes_ownbusns_600amtbus_608=. if ifyes_ownbusns_600amtbus_608==0
replace ifyes_ownbusns_600amtbus_608=. if KEY=="uuid:88477cfe-4d6f-41ca-b000-4524df533c37"
replace ifyes_ownbusns_600amtbus_608=. if KEY=="uuid:a270f279-a387-48bd-ac1f-7a6a9c2cc6e5"
replace ifyes_ownbusns_600amtbus_608=. if KEY=="uuid:a270f279-a387-48bd-ac1f-7a6a9c2cc6e5"
replace ifyes_ownbusns_600amtbus_608=200 if KEY=="uuid:aa48ded4-b6ff-413c-ba37-d0c835bf29db"

	*609
drop ifyes_ownbusns_600contbus_609_2 ifyes_ownbusns_600contbus_609_3
rename ifyes_ownbusns_600contbus_609_1 ifyes_ownbusns_600contbus_609
replace ifyes_ownbusns_600contbus_609=. if ifyes_ownbusns_600contbus_609==-55

	*7. EMPLOYMENT 

	*700
drop paid_700_2 paid_700_3
rename paid_700_1 paid_700
replace paid_700=. if paid_700==-55

replace paid_700=0 if KEY=="uuid:7111e09a-66f3-4d53-b028-63a29196dd18"
replace paid_700=0 if KEY=="uuid:7e2801ca-d163-4f49-aa2b-f458223aafa0"
replace paid_700=0 if KEY=="uuid:1e682e40-1137-4da7-9afe-78f5458a2eba"
replace paid_700=0 if KEY=="uuid:7c988277-37d1-4a68-95d6-369df208a215"
replace paid_700=1 if KEY=="uuid:a39b546a-24e7-4469-9a44-e881ed7c377a"
replace paid_700=0 if KEY=="uuid:2371b0dc-da28-424a-9c28-503e2e7d522b"
replace paid_700=1 if KEY=="uuid:5bdfd9c1-215d-44ca-b7c5-6d5813b269b4"

replace paid_700=0 if seekjob_701_1!=.
replace paid_700=1 if paid_700==. & seekjob_701_1==.


	*701
replace seekjob_701_1=. if KEY=="uuid:2371b0dc-da28-424a-9c28-503e2e7d522b"
drop seekjob_701_3-seekjob_701_10
replace seekjob_701_1=. if seekjob_701_1==55|seekjob_701_1==-55

	*702
replace dayspaid_702=. if inlist(dayspaid_702,-99,-66,-55,-77)
replace dayspaid_702=30 if KEY=="uuid:a39b546a-24e7-4469-9a44-e881ed7c377a"
replace dayspaid_702=1 if KEY=="uuid:5bdfd9c1-215d-44ca-b7c5-6d5813b269b4"

	*703
replace earnday_703=. if inlist(dayspaid_702,-99,-66,-55,-77)
replace earnday_703=1000 if KEY=="uuid:504f95b2-18a9-4624-ab92-d349c7b2fe8c"
replace earnday_703=400 if KEY=="uuid:07d08b63-e7a0-4967-9a88-431d3af26547"
replace earnday_703=1500 if KEY=="uuid:a39b546a-24e7-4469-9a44-e881ed7c377a"
replace earnday_703=500 if KEY=="uuid:5bdfd9c1-215d-44ca-b7c5-6d5813b269b4"
replace earnday_703=. if earnday_703==-55
replace earnday_703=. if earnday_703==-77
replace earnday_703=. if earnday_703==-99


	*704
drop ptimework_704_2-ptimework_704_4
replace ptimework_704_1=. if ptimework_704_1==-55
rename withoutpay_705_1 withoutpay_705

	*705
drop withoutpay_705_2 withoutpay_705_3 withoutpay_705_4
replace withoutpay_705=. if withoutpay_705==-55|withoutpay_705==55

	*706
replace activ_706_1=. if activ_706_1==-55
drop activ_706_4-activ_706_8 
drop activ_706_9-activ_706_11

replace activ_706_3=-66 if activ_706_3==10
lab def activ_new 1 "Cooking" 2 "Cleaning" 3 "Studying" 4 "Washing clothes" 5 "Caring for the other siblings" 6 "Getting water" 7 "Shopping for the family or household" 8 "Resting/Playing" 9 "All above"  -66 "Other(specify)"
lab val activ_706_3 activ_new

replace activ_706_3=. if activ_706_3==55
replace activ_706_other="" if activ_706_3!=-66 & activ_706_3!=. & activ_706_other!=""


lab def activ_706 -66 "Other(Specify)", modify
foreach var in activ_706_1 activ_706_2{
replace `var'=-66 if `var'==10
lab val `var' activ_706
}


	*707
drop pcktmoney_707_2 pcktmoney_707_3 
replace pcktmoney_707_1=. if inlist(pcktmoney_707_1,-55,55)
rename pcktmoney_707_1 pcktmoney_707
replace pcktmoney_707=0 if pcktmoney_707==.

*8.ENTREPRENEURSHIP SKILLS AND PERSONAL FINANCE
   *800
drop borrow_800_2 borrow_800_3
rename borrow_800_1 borrow_800
replace borrow_800=. if borrow_800==-55
replace borrow_800=0 if borrow_800==.

	*801
drop  moneyoffer_801_3 moneyoffer_801_2
replace moneyoffer_801_1=. if  moneyoffer_801_1==-55
rename moneyoffer_801_1 moneyoffer_801

	*802
drop moneyoffer_802_2 moneyoffer_802_3 
rename moneyoffer_802_1 moneyoffer_802
replace moneyoffer_802=. if moneyoffer_802==-55

	*803
drop savings_803_2-savings_803_4
replace savings_803_1=. if savings_803_1==-55|savings_803_1==0
rename savings_803_1 savings_803
replace savings_803=2 if KEY=="uuid:1d9416cb-a448-4489-bedd-f946c6953853"

	*804
replace savedmon_804_1=8 if KEY=="uuid:cdfb1df5-bc54-4398-a7c5-275a96a21055"
replace savedmon_804_1=3 if KEY=="uuid:9595734b-5285-4ac7-abe4-7d45ca3f2369"

drop savedmon_804_3-savedmon_804_9
replace savedmon_804_1=. if savedmon_804_1==-55
replace savedmon_804_1=-66 if savedmon_804_1==8
lab def savelbl 1 "No,I have no savings" 2 "Yes, hidden in a box/drawer" 3 "Yes, another person holds it for me" 4 "Yes, in a group account at a bank" 5 "Yes, in an individual account at a bank" 6 " Yes, in a SACCO (Savings and Credit Co-op)" 7 "Yes, in a telecom company account (MTN mobile money, Tigo Cash, Airtel mobile money,etc.)" -66 "Other (specify)", modify
lab val savedmon_804_1 savelbl
rename savedmon_804_1 savedmon_804
drop savedmon_804_2
replace savedmon_804_other="In tontine" if KEY=="uuid:100b4594-a998-4f19-8865-c7eecf7c48e9"
replace savedmon_804=3 if KEY=="uuid:ae64d902-be21-4ec0-9515-01c56f3c5140"
replace savedmon_804_other="" if savedmon_804_other=="-55"

	*805
drop savedamt_805_2-savedamt_805_4
replace savedamt_805_1=. if savedamt_805_1==-55
rename savedamt_805_1 savedamt_805

*9 YOUTH SKILL DEVELOPMENT SCALE
drop youthskillsgenerated_table_list_	youthskillsreserved_name_for_fie
drop youthskillshhprod_901_2 youthskillsserv_902_2

	*900
drop youthskillscraft_900_2-youthskillscraft_900_7
replace youthskillscraft_900_1=. if youthskillscraft_900_1==-55|youthskillscraft_900_1==55
rename youthskillscraft_900_1 youthskillscraft_900
replace youthskillscraft_900=1 if youthskillscraft_900==.

	*901
drop youthskillshhprod_901_3-youthskillshhprod_901_7
replace youthskillshhprod_901_1=. if youthskillshhprod_901_1==-55|youthskillshhprod_901_1==55
rename youthskillshhprod_901_1 youthskillshhprod_901
replace youthskillshhprod_901=3 if KEY=="uuid:0c3e162e-f571-4067-b129-527d89fc6f5f"
replace youthskillshhprod_901=3 if KEY=="uuid:aebfb360-e1ec-42bb-8278-c0edf87f8b5f"
replace youthskillshhprod_901=1 if youthskillshhprod_901==.


*replace youthskillshhprod_901_2=. if youthskillshhprod_901_2==-55
*rename youthskillshhprod_901_1 youthskillshhprod_901
*replace youthskillshhprod_901_2=. if KEY=="uuid:2c16a391-ddb0-4eed-b9e6-9d97d5067277"
*replace youthskillshhprod_901_2=. if KEY=="uuid:f3e0da77-f842-4a35-b6e2-b34ad0b70d91"
/*
*replace youthskillshhprod_901_2=. if KEY=="uuid:cce430ce-12cf-4dd4-bc5d-916de9df78d7"
replace youthskillshhprod_901_2=. if KEY=="uuid:57802975-a683-4c7a-970e-c434e18c1508"
replace youthskillshhprod_901_2=. if KEY=="uuid:887ecbb2-dc21-464b-9719-6dd910e27480"
replace youthskillshhprod_901_2=. if KEY=="uuid:ff031d97-da6d-480f-9e8f-996206f1afe5"
replace youthskillshhprod_901_2=. if KEY=="uuid:bde26fb0-a3fb-4aeb-afa7-ba4e31714a95"
*/
	*902
drop youthskillsserv_902_3-youthskillsserv_902_7
replace youthskillsserv_902_1=. if youthskillsserv_902_1==-55|youthskillsserv_902_1==55
rename youthskillsserv_902_1 youthskillsserv_902
replace youthskillsserv_902=5 if KEY=="uuid:2c16a391-ddb0-4eed-b9e6-9d97d5067277"
replace youthskillsserv_902=6 if KEY=="uuid:0ba9bb76-0751-4c51-a0e3-fc6f8c232a27"
replace youthskillsserv_902=2 if KEY=="uuid:26a50eb4-e826-438d-a1ce-bf741cf5baf6"
replace youthskillsserv_902=1 if youthskillsserv_902==.


*replace youthskillsserv_902_2=. if youthskillsserv_902_2==-55|youthskillsserv_902_2==55
*replace youthskillsserv_902_2=. if KEY=="uuid:26a50eb4-e826-438d-a1ce-bf741cf5baf6"
*replace youthskillsserv_902_2=. if KEY=="uuid:57802975-a683-4c7a-970e-c434e18c1508"
*replace youthskillsserv_902_2=. if KEY=="uuid:bde26fb0-a3fb-4aeb-afa7-ba4e31714a95"

	*903
drop youthskillsagri_903_4-youthskillsagri_903_7
replace youthskillsagri_903_1=5 if KEY=="uuid:da6053e5-8f77-4190-bdf8-3fde5eb54e29"
replace youthskillsagri_903_1=. if youthskillsagri_903_1==55|youthskillsagri_903_1==-55
replace youthskillsagri_903_1=youthskillsagri_903_2 if youthskillsagri_903_1!=. & youthskillsagri_903_2!=. & youthskillsagri_903_2!=55
drop youthskillsagri_903_2 youthskillsagri_903_3
rename youthskillsagri_903_1 youthskillsagri_903
replace youthskillsagri_903=1 if youthskillsagri_903==.

*Q903, the answer was -55. Looking at the number of answered questions out of 13 question, a number was assigned to 903
replace youthskillsagri_903=1 if KEY=="uuid:2a2fadb1-8813-44f0-93aa-66bf67057bb6"
replace youthskillsagri_903=2 if KEY=="uuid:e9a90d6c-9698-44c9-9161-8d01d03767d9"
replace youthskillsagri_903=1 if KEY=="uuid:d979eb94-0456-44c0-bd2c-ecfdd621ca97"

	*904
drop youthskillsjobsearch_904_3-youthskillsjobsearch_904_7
replace youthskillsjobsearch_904_1=youthskillsjobsearch_904_2 if youthskillsjobsearch_904_1!=. & youthskillsjobsearch_904_2!=. 
drop youthskillsjobsearch_904_2
replace youthskillsjobsearch_904_1=. if youthskillsjobsearch_904_1==55|youthskillsjobsearch_904_1==-55
rename youthskillsjobsearch_904_1 youthskillsjobsearch_904

replace youthskillsjobsearch_904=5 if KEY=="uuid:89278b67-0d49-4d41-9af6-15f1fd36d41d"

replace youthskillsjobsearch_904=1 if youthskillsjobsearch_904==.

	*905
drop youthskillssales_905_3-youthskillssales_905_7
replace youthskillssales_905_1=. if youthskillssales_905_1==-55|youthskillssales_905_1==55
drop youthskillssales_905_2 
replace youthskillssales_905_1=. if youthskillssales_905_1==-55
rename youthskillssales_905_1 youthskillssales_905
replace youthskillssales_905=1 if youthskillssales_905==.

	*906
drop youthskillsanim_906_3-youthskillsanim_906_7
replace youthskillsanim_906_1=. if youthskillsanim_906_1==55|youthskillsanim_906_1==-55
drop youthskillsanim_906_2
rename youthskillsanim_906_1 youthskillsanim_906
replace youthskillsanim_906=3 if KEY=="uuid:f5ac1f96-b73f-43ff-b2b3-10d45675912b"
replace youthskillsanim_906=6 if KEY=="uuid:19864401-fe06-4860-81e6-df2714ff3219"
replace youthskillsanim_906=1 if youthskillsanim_906==.

*Q906, the answer was -55. Given that most of the answers are between 1 and 2 (for 8to9 out of 13 question), 906 was given 1
replace youthskillsanim_906=1 if KEY=="uuid:3387d58a-bfbf-415b-b184-3196bf25c171"
replace youthskillsanim_906=1 if KEY=="uuid:23e0f0dc-405d-4eab-b6b6-9e3fd94ef456"
	
	*907
replace youthskillscomp_907_1=2 if KEY=="uuid:8363c819-ca2c-4e6e-b578-ff6944158ad5"

drop youthskillscomp_907_3-youthskillscomp_907_7
replace youthskillscomp_907_1=. if youthskillscomp_907_1==-55
drop youthskillscomp_907_2
rename youthskillscomp_907_1 youthskillscomp_907
replace youthskillscomp_907=1 if youthskillscomp_907==.

	*908
drop youthskillsfinskills_908_3-youthskillsfinskills_908_7
drop youthskillsfinskills_908_2 
replace youthskillsfinskills_908_1=. if youthskillsfinskills_908_1==-55|youthskillsfinskills_908_1==55
rename youthskillsfinskills_908_1 youthskillsfinskills_908
replace youthskillsfinskills_908=1 if youthskillsfinskills_908==.

	*909
drop youthskillsvaladd_909_3-youthskillsvaladd_909_7
drop youthskillsvaladd_909_2
replace youthskillsvaladd_909_1=. if youthskillsvaladd_909_1==55|youthskillsvaladd_909_1==-55
rename youthskillsvaladd_909_1 youthskillsvaladd_909

replace youthskillsvaladd_909=3 if KEY=="uuid:aebfb360-e1ec-42bb-8278-c0edf87f8b5f"
replace youthskillsvaladd_909=1 if youthskillsvaladd_909==.
	*910
drop youthskillsmgt_910_3-youthskillsmgt_910_7
drop youthskillsmgt_910_2
replace youthskillsmgt_910_1=. if youthskillsmgt_910_1==55|youthskillsmgt_910_1==-55
rename youthskillsmgt_910_1 youthskillsmgt_910
replace youthskillsmgt_910=4 if KEY=="uuid:f03e143c-781c-48b6-8fec-bf2348743819"
replace youthskillsmgt_910=1 if youthskillsmgt_910==.

	*911
drop youthskillsvoctr_911_3-youthskillsvoctr_911_7
drop youthskillsvoctr_911_2
replace youthskillsvoctr_911_1=. if youthskillsvoctr_911_1==55|youthskillsvoctr_911_1==-55
rename youthskillsvoctr_911_1 youthskillsvoctr_911
replace youthskillsvoctr_911=3 if KEY=="uuid:8d2216f1-1bfb-4d1c-b406-76d4d28d2013"
replace youthskillsvoctr_911=2 if KEY=="uuid:06cba5fb-54b3-42a2-bddc-d972288b734d"
replace youthskillsvoctr_911=1 if youthskillsvoctr_911==.


*Q911, the answer was -55. Given that the answer is above level 3 for 8 out of 13 question, 911 was given 3
replace youthskillsvoctr_911=3 if KEY=="uuid:eafd6e8c-5ccd-422b-af33-68fe8bcdf538"
	
	*912
drop youthskillsstartbus_912_3-youthskillsstartbus_912_7
drop youthskillsstartbus_912_2
replace youthskillsstartbus_912_1=. if youthskillsstartbus_912_1==55|youthskillsstartbus_912_1==-55
rename youthskillsstartbus_912_1 youthskillsstartbus_912
replace youthskillsstartbus_912=2 if KEY=="uuid:8fe38630-5437-4a31-814d-b79f1b1ad23a"
replace youthskillsstartbus_912=1 if youthskillsstartbus_912==.

	*10 ENTREPRENEURSHIP KNOWLEDGE
	*1000
	
local item1 "DevProBrand Advert KeepingAccount ConducProQAssurance BusinessReg OpenBid VerbalProm DivLabour"
foreach t in `item1'{
	gen mrktskl_1000_`t'=0
	lab variable mrktskl_1000_`t' "1000_How would you apply marketing skills to your business?"
	lab value mrktskl_1000_`t' yesno
	}
foreach var in mrktskl_1000_1 mrktskl_1000_2 mrktskl_1000_3 mrktskl_1000_4 mrktskl_1000_5 mrktskl_1000_6 mrktskl_1000_7 mrktskl_1000_8 mrktskl_1000_9{
	replace mrktskl_1000_DevProBrand=1 if `var'==1
	replace mrktskl_1000_Advert=1 if `var'==2
	replace mrktskl_1000_KeepingAccount=1 if `var'==3
	replace mrktskl_1000_ConducProQAssurance=1 if `var'==4
	replace mrktskl_1000_BusinessReg=1 if `var'==5
	replace mrktskl_1000_OpenBid=1 if `var'==6
	replace mrktskl_1000_VerbalProm=1 if `var'==7 
	replace mrktskl_1000_DivLabour=1 if `var'==8
	}
forval l=1/9{
	drop mrktskl_1000_`l'
	}
order mrktskl_1000_* , before(busplnskl_1001_1)

	*1001

local item2 "BusiName ReceiFromSales MarketgPlan PandLStatemt Audit "
foreach t in `item2'{
	gen busplnskl_1001_`t'=0
	lab variable busplnskl_1001_`t' "1001_What should be included in your business plan?"
	lab value busplnskl_1001_`t' yesno
	}
foreach var in busplnskl_1001_1 busplnskl_1001_2 busplnskl_1001_3 busplnskl_1001_4 busplnskl_1001_5 busplnskl_1001_6{
	replace busplnskl_1001_BusiName=1 if `var'==1
	replace busplnskl_1001_ReceiFromSales=1 if `var'==2
	replace busplnskl_1001_MarketgPlan=1 if `var'==3
	replace busplnskl_1001_PandLStatemt=1 if `var'==4
	replace busplnskl_1001_Audit=1 if `var'==5
	
	}
forval l=1/6{
	drop busplnskl_1001_`l'
	}
order busplnskl_1001_* , after(mrktskl_1000_DivLabour)

	*1002
replace proftamt_1002=. if proftamt_1002==-55|proftamt_1002==-99

	*1003 

local item3 "SellMorePaper IncreasPrice EmploySone UseCheaperMat"
foreach t in `item3'{
	gen incrproft_1003_`t'=0
	lab variable incrproft_1003_`t' "1003_In the above example from question 1002, how would you be able to increase"
	lab value incrproft_1003_`t' yesno
	}
foreach var in incrproft_1003_1 incrproft_1003_2 incrproft_1003_3 incrproft_1003_4 {
	replace incrproft_1003_SellMorePaper=1 if `var'==1
	replace incrproft_1003_IncreasPrice=1 if `var'==2
	replace incrproft_1003_EmploySone=1 if `var'==3
	replace incrproft_1003_UseCheaperMat=1 if `var'==4
	}
forval l=1/5{
	drop incrproft_1003_`l'
	}
order incrproft_1003_* , after(proftamt_1002)
	
	*1004
drop notbusgrth_1004_6 
replace notbusgrth_1004_1=notbusgrth_1004_2 if notbusgrth_1004_1==-55 & notbusgrth_1004_2!=-55 & notbusgrth_1004_2!=.
drop notbusgrth_1004_2 notbusgrth_1004_3 notbusgrth_1004_5
replace notbusgrth_1004_1=. if notbusgrth_1004_1==-55 
rename notbusgrth_1004_1 notbusgrth_1004
replace notbusgrth_1004_4=. if notbusgrth_1004_4==-55
drop notbusgrth_1004_4

	*1005
local item4 "CostXmtSell CostXlsSell SellXls50Xs Sellmt50Xs"
foreach t in `item4'{
	gen knownoproft_1005_`t'=0
	lab variable knownoproft_1005_`t' "1005_How do you know a business is not profitable?"
	lab value knownoproft_1005_`t' yesno
	}
foreach var in knownoproft_1005_1 knownoproft_1005_2 knownoproft_1005_5 knownoproft_1005_4{
	replace knownoproft_1005_CostXmtSell=1 if `var'==1
	replace knownoproft_1005_CostXlsSell=1 if `var'==2
	replace knownoproft_1005_SellXls50Xs=1 if `var'==3
	replace knownoproft_1005_Sellmt50Xs=1 if `var'==4
	}
forval l=1/5{
	drop knownoproft_1005_`l'
	}
order knownoproft_1005_* , after(notbusgrth_1004)
	
		*11. ASPIRATIONS 
		
	*1100
replace schooling_1100_1=. if schooling_1100_1==-55
drop schooling_1100_2-schooling_1100_9
rename schooling_1100_1 schooling_1100

	*1101
drop occup_1101_6-occup_1101_7
drop occup_1101_2-occup_1101_5
replace occup_1101_other="" if occup_1101_1!=6 
recode occup_1101_1 6=-66,gen(occup_1101)
replace occup_1101=. if occup_1101==-55
lab var occup_1101 "1101_After school, what occupation would you like to have in your life?"
lab def occuplbl 1 "Farming" 2 "Business" 3 "Petty Trading" 4 "Skilled labor (carpenter,tailor,etc)" 5 "Professional/salaried(lawyer,doctor,accountant,teacher,etc)" -66 "Other(specify)"
lab val occup_1101 occuplbl
replace occup_1101=. if occup_1101==-55
drop occup_1101_1
order occup_1101, after(schooling_1100)

	*1002

replace busnsftr_1102_1=-99 if KEY=="uuid:8d370d38-8a3d-4197-8cfe-bb11aa78028e"
replace busnsftr_1102_1=-99 if KEY=="uuid:8fb6e251-0f07-4adc-886b-81478dc0c57b"
replace busnsftr_1102_1=2 if KEY=="uuid:8f5ccba8-f45c-4acd-be8b-900cd1bab955"

drop  busnsftr_1102_3-busnsftr_1102_4
replace busnsftr_1102_1=. if busnsftr_1102_1==-55
replace busnsftr_1102_1=-99 if busnsftr_1102_1==99
rename busnsftr_1102_1 busnsftr_1102

*11 ASPIRATIONS
*1101
replace occup_1101=. if occup_1101==8
replace occup_1101_other="" if occup_1101_other=="-55"

*1102
replace busnsftr_1102=1 if busnsftr_1102==0
drop busnsftr_1102_2
replace busnsftr_1102=-99 if busnsftr_1102==.

*12 ABOUT YOUR LIFE
	
	*1200
drop univ_1200_4-univ_1200_11
replace univ_1200_1=. if univ_1200_1==55|univ_1200_1==-55
drop univ_1200_2 univ_1200_3
rename univ_1200_1 univ_1200
replace univ_1200=10 if KEY=="uuid:671b8929-9d6d-4da2-bc72-4f6e40f84f5f"

	*1201
drop reas_1201_5-reas_1201_8
drop reas_1201_2 reas_1201_3 reas_1201_4
replace reas_1201_1=. if reas_1201_1==-55|reas_1201_1==10
recode reas_1201_1 (7=-66 "Other reason"), gen (reas_1201)
lab var reas_1201 "1201_Why do you feel that way?"
drop reas_1201_1
order reas_1201, after(univ_1200)
replace reas_1201=3 if KEY=="uuid:9a532b26-4e31-4362-8c9d-b06f794dbeca"
replace reas_1201=2 if KEY=="uuid:671b8929-9d6d-4da2-bc72-4f6e40f84f5f"


	*1202
drop hswork_1202_3-hswork_1202_11
drop hswork_1202_2
replace hswork_1202_1=. if hswork_1202_1==-55
rename hswork_1202_1 hswork_1202

replace hswork_1202=5 if KEY=="uuid:4c761381-3381-467a-8642-2c0708f69eb1"

	*1203
replace reas_1203_1=4 if reas_1203_1==66|reas_1203_1==5
replace reas_1203_1=. if reas_1203_1==-55|reas_1203_1==55
drop reas_1203_4 reas_1203_5
drop reas_1203_2 reas_1203_3
recode reas_1203_1 (4=-66 "Other reason"), gen (reas_1203)
replace reas_1203=-66 if reas_1203_other!="" & !inlist(reas_1203,1,2,3)
lab var reas_1203 "1203_Why do you feel that way?"
order reas_1203, after(hswork_1202)

replace reas_1203=2 if KEY=="uuid:ef08f55e-5cfb-4814-8578-95dafd2b6b7a"
replace reas_1203=. if reas_1203==6
drop reas_1203_1
	***check the other option here 

	*1204
drop child_1204_4-child_1204_11
drop child_1204_2 child_1204_3
replace child_1204_1=. if child_1204_1==-55
rename child_1204_1 child_1204
replace child_1204=5 if KEY=="uuid:623bcbde-666c-40ae-bfb7-d6190483ab63"
replace child_1204=5 if KEY=="uuid:5cda54a2-fd50-4df8-833e-0c01102546b6"
	
	*1205
replace reas_1205_1=5 if KEY=="uuid:6260b24d-0c2a-4aaa-850a-66f2d0e10482"
replace reas_1205_1=5 if KEY=="uuid:3f5387da-6b9a-4f3e-9c8a-4c07ac60b371"
replace reas_1205_1=5 if KEY=="uuid:a906af32-419e-4b08-9798-eae91fa14921"
replace reas_1205_other="" if KEY=="uuid:b0ec52e9-4403-42c0-a51a-5b50205623e9"
replace reas_1205_other="" if KEY=="uuid:5cbc8ddc-e6dc-4bd1-990a-3b0f0afe088c"
replace reas_1205_1=5 if KEY=="uuid:42aaed76-b522-45e7-b748-9d60cee279b4"
replace reas_1205_1=5 if KEY=="uuid:0a101192-1f76-4902-94ca-856ec6b6dcd4"
replace reas_1205_1=-55 if KEY=="uuid:66f37816-dd92-47e7-af70-5573eeeb1415"
replace reas_1205_other="" if KEY=="uuid:66f37816-dd92-47e7-af70-5573eeeb1415"
	
drop reas_1205_4-reas_1205_6
drop reas_1205_2 reas_1205_3
replace reas_1205_1=. if reas_1205_1==-55|reas_1205_1==55
recode reas_1205_1 (5=-66 "Other reason"), gen (reas_1205)
replace reas_1205=-66 if reas_1205_other!="" & !inlist(reas_1205_1,1,2,3,4)
lab var reas_1205 "1205_Why do you feel that way?"
*drop reas_1205_1
order reas_1205, before(reas_1205_other)
*rename reas_1205_1 reas_1205
replace reas_1205=-66 if reas_1205==6
drop reas_1205_1

	*1206
drop head_1206_4-head_1206_11
drop head_1206_2 head_1206_3
replace head_1206_1=. if head_1206_1==-55|head_1206_1==55
rename head_1206_1 head_1206

	*1207
replace reas_1207_1=5 if KEY=="uuid:42aaed76-b522-45e7-b748-9d60cee279b4"
replace reas_1207_1=5 if KEY=="uuid:0a101192-1f76-4902-94ca-856ec6b6dcd4"
replace reas_1207_1=5 if KEY=="uuid:66f37816-dd92-47e7-af70-5573eeeb1415"
replace reas_1207_1=5 if KEY=="uuid:6260b24d-0c2a-4aaa-850a-66f2d0e10482"
replace reas_1207_1=5 if KEY=="uuid:3f5387da-6b9a-4f3e-9c8a-4c07ac60b371"
replace reas_1207_1=5 if KEY=="uuid:e1261605-dcc3-40f1-a3a7-7accb94a732a"
replace reas_1207_1=5 if KEY=="uuid:671b8929-9d6d-4da2-bc72-4f6e40f84f5f"
	
drop reas_1207_4-reas_1207_6
replace reas_1207_1=. if reas_1207_1==-55|reas_1207_1==55
recode reas_1207_1 (5=-66 "Other reason"), gen (reas_1207)
replace reas_1207=-66 if reas_1207_other!="" & !inlist(reas_1207_1,1,2,3,4)
lab var reas_1207 "1207_Why do you feel that way?"
replace reas_1207=3 if reas_1207==0
replace reas_1207_1=-66 if reas_1207_1==6
*rename reas_1207_1 reas_1207
order reas_1207, before(reas_1207_other)

replace reas_1207_2=. if KEY=="uuid:f459fb24-1306-4fd0-a586-69ec92ac2b4c"
replace reas_1207_2=. if KEY=="uuid:afc61595-a1cd-45d0-bc03-e15610f65ffe"
replace reas_1207_2=. if KEY=="uuid:df584dda-e524-4f77-96af-443f7dfdb056"
replace reas_1207_3=. if KEY=="uuid:df584dda-e524-4f77-96af-443f7dfdb056"
drop reas_1207_1-reas_1207_3
	
	*1208
drop safe_1208_2-safe_1208_11
replace safe_1208_1=. if safe_1208_1==55|safe_1208_1==-55
rename safe_1208_1 safe_1208
replace safe_1208=10 if KEY=="uuid:6630f9ce-cbdd-4921-903f-eec8c1d1fab2"

	*1209
replace reas_1209_1=3 if KEY=="uuid:1f2f0e33-514d-481e-b916-10475ab66d4a"
replace reas_1209_1=2 if KEY=="uuid:df32f47b-1b69-4e6a-bb1a-8ea553cfd76a"
replace reas_1209_other="There is security and I live near the shop" if KEY=="uuid:1f2f0e33-514d-481e-b916-10475ab66d4a"
replace reas_1209_1=. if reas_1209_1==4
replace reas_1209_1=55 if reas_1209_1==5

drop reas_1209_3-reas_1209_4
replace reas_1209_1=. if reas_1209_1==-55|reas_1209_1==55
*replace reas_1209_1=. if inlist(reas_1209_1,4,5)
recode reas_1209_1 (3=-66 "Other reason"), gen (reas_1209)
replace reas_1209=-66 if reas_1209_other!="" & !inlist(reas_1209,1,2,-66)
lab var reas_1209 "1209_Why do you feel that way?"
replace reas_1209=-66 if reas_1209==66
replace reas_1209=. if inlist(reas_1209_other,"-55","-66")
replace reas_1209_other="" if inlist(reas_1209_other,"-55","-66")
*drop reas_1209_1 reas_1209_2 
replace reas_1209=-66 if reas_1209==6
order reas_1209, before(reas_1209_other)
drop reas_1209_1 reas_1209_2

	*13. YOUR INTERESTS

drop interest_1300generated_table_lis interest_1300reserved_name_for_f
drop interest_1300ideasproj_1300_3-interest_1300ideasproj_1300_6
rename interest_1300* * 

	*1300
recode ideasproj_1300_1 (4=4 "True"), gen (ideasproj_1300)
lab def intlbl 1 "Not true" 2 "Not so true" 3 "Somehow true" 4 "True" 5 "Very true"
lab val ideasproj_1300 intlbl
lab var ideasproj_1300 "1300_New ideas and projects sometimes distract me from older projects"
replace ideasproj_1300=. if ideasproj_1300==-55
drop ideasproj_1300_1 ideasproj_1300_2
order ideasproj_1300, after (reas_1209_other)	


	*1301
drop diffintrest_1301_3-diffintrest_1301_6
lab val diffintrest_1301_1 intlbl
rename diffintrest_1301_1 diffintrest_1301
lab var diffintrest_1301 "1301_It is difficult for me to stay interested in a project that takes a long time to finish"
replace diffintrest_1301=. if diffintrest_1301==-55
drop diffintrest_1301_2

	*1302
drop passchang_1302_3-passchang_1302_6
lab val passchang_1302_1 intlbl
rename passchang_1302_1 passchang_1302
lab var passchang_1302 "1302_My interests/passions change from year to year"
replace passchang_1302=. if passchang_1302==-55
drop passchang_1302_2

	*1303
drop newproj_1303_3-newproj_1303_6
drop newproj_1303_2
lab val newproj_1303_1 intlbl
rename newproj_1303_1 newproj_1303
lab var newproj_1303 "1303_I become interested in new projects every few months"
replace newproj_1303=. if newproj_1303==-55|newproj_1303==55

	*14. YOUR IDEAS
*1400
replace proj_desc_1400="" if proj_desc_1400=="-55"
replace proj_desc_1400="" if proj_desc_1400=="-77"

	*1403
replace drawing_1403=. if drawing_1403==-55|drawing_1403==25

	*1404
replace drawing_1404=. if inlist(drawing_1404,-55,24,23,52)
	*1405
replace drawing_1405=. if inlist(drawing_1405,-55,24,52,55)

drop dup entry tdy keepme



	// Save with PIIS in encrypted location
cd "[directory]/Cleaned_Data"

save Student_Survey_cleaned20160907, replace
	
	// Save Without PI
cd "$clean_dir"	

		*Deidentification
decode village, gen(village_str)
drop village

#delimit 
local Piis ///
first_name_200 family_name_200 phonenumbers_2_205moth_name_205 phonenumbers_3_205fath_name_205 phonenumbers_3_205phone_fath_1_2 ///
phonenumbers_3_205phone_fath_2_2 phonenumbers_3_205phone_fath_3_2 phonenumbers_4_205oth_name_205 phonenumbers_4_205phone_oth_2_20 ///
phonenumbers_4_205phone_oth_3_20  phonenumbers_4_205phone_oth_1_20 emails_206email_oth emails_206email_pers ///
phonenumbers_2_205phone_moth_1_2  phonenumbers_2_205phone_moth_2_2  phonenumbers_2_205phone_moth_3_2 ///
village_str village_201 phonenumbers_1_205phone_pers_1_2 phonenumbers_1_205phone_pers_2_2  phonenumbers_1_205phone_pers_3_2
;
# delimit cr
 
foreach var1 of local Piis{
replace `var1'="deindentified"
}

save Student_Survey_cleaned_NOPII,replace
saveold Student_Survey_cleaned_NOPIIv12, version(12) replace
export excel "Student_Survey_cleaned_NOPII.csv", replace
codebookout "Codebook_Master_Student.xls",replace









